package com.thread.domain.domain;

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.lang.management.ThreadMXBean;

public class ThreadMain {

	public static void main(String[] args) {
		//java虚拟机线程管理接口
		ThreadMXBean threadMain=ManagementFactory.getThreadMXBean();
		//线程相关信息  监听线程
		ThreadInfo[] infos=threadMain.dumpAllThreads(false, false);
		for (ThreadInfo threadInfo : infos) {
			/*[5]Attach Listener   程序信息，线程栈
			[4]Signal Dispatcher  分发虚拟机信号的线程
			[3]Finalizer 
			[2]Reference Handler  负责清除应用线程
			[1]main*/
			System.out.println("["+threadInfo.getThreadId()+"]"+threadInfo.getThreadName());
		}
		
	}
}
